#!/usr/bin/env python
# coding=UTF-8

import json
import os

data_path = os.path.join(os.path.dirname(__file__),
                         '..', 'data')


def dict_2_str():
    data = {
        "customers": [
            {
                "customer":
                {
                    "id": 2,
                    "name": "Amy",
                    "phone": 132456
                }
            },
            {
                "customer":
                {
                    "id": 1,
                    "name": "Lily",
                    "phone": 789465
                }

            }
        ]
    }
    print(type(data))
    data_json = json.dumps(data)
    print(data_json)
    print(type(data_json))


def str_2_dict():
    with open(data_path + "/customer.json", 'r') as f:
        eat_dict = json.load(f)

    print(eat_dict)
    print(type(eat_dict))


if __name__ == '__main__':
    dict_2_str()
    str_2_dict()
